<?php
//1. co_accesstoken.php
//2. pre_authcode.php    refresh pre auth code

// //http://parkson.omnimkt.com/api/co_accesstoken.php
//

$component_appid='wx3464c6b9fd10bf5c'; //laji's

$component_appid='wx82aa345f1fb8714b'; //selim's
$getprecode=json_decode(file_get_contents('/var/www/api/log/pre_auth_code.json'), true);
$preauthcode=$getprecode['pre_auth_code'];
 
$redirect_uri = urlencode('http://parkson.omnimkt.com/b.php');
$url='https://mp.weixin.qq.com/cgi-bin/componentloginpage?component_appid='.$component_appid.'&pre_auth_code='.$preauthcode.'&redirect_uri='.$redirect_uri;
//header('Location: '.$url);
 
echo "<div style='margin:0 auto;'><h2><a href='{$url}'>授权微信小程序</a></h2></div>";